/**
 * 
 */
package com.jml.security.sms;

import com.jml.security.properties.SecurityProperties;
import com.jml.security.validate.ValidateCode;
import com.jml.security.validate.ValidateCodeGenerator;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("smsCodeGenerator")
public class SmsCodeGenerator implements ValidateCodeGenerator {
	@Autowired
	private SecurityProperties securityProperties;
	public ValidateCode generate(HttpServletRequest request) {
		String code = "1994";
		int length = securityProperties.getCode().getSms().getLength();
		int expireTime = securityProperties.getCode().getSms().getExpireTime();
		String url = securityProperties.getCode().getSms().getUrl();
		return new ValidateCode(code, expireTime);
	}
	
	public SecurityProperties getSecurityProperties() {
		return securityProperties;
	}
	public void setSecurityProperties(SecurityProperties securityProperties) {
		this.securityProperties = securityProperties;
	}
}
